﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Sahit.iSoilHotel.DistributedServices.MainBoundedContext.Interfaces;
using Sahit.iSoilHotel.Application.MainBoundedContext.Tavern.Interfaces;
using Sahit.iSoilHotel.Application.MainBoundedContext.DTO.AuthenticationAgg;
using Sahit.iSoilHotel.DistributedServices.MainBoundedContext.InstanceProviders;

namespace Sahit.iSoilHotel.DistributedServices.MainBoundedContext
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "TavernServicex" in code, svc and config file together.
     [UnityInstanceProviderServiceBehavior()]
    public class TavernAuthenticationService : ITavernAuthenticationService
    {
        #region Members

        private readonly IAccountService accountService;

        #endregion

        #region Constructor

        public TavernAuthenticationService(IAccountService accountService)
        {
            if (accountService == null)
                throw new ArgumentNullException("AccountService");

            this.accountService = accountService;
        }

        #endregion

        #region ITavernService Methods

        public bool ValidateAccount(string userName, string password)
        {
            return accountService.ValidateAccount(userName, password);
        }

        public AccountDTO GetAccountByUserName(string userName)
        {
            return accountService.GetAccountByUserName(userName);
        }

        public RegistrationResultDTO RegisterAccount(RegistrationRequestDTO registrationRequest)
        {
            return accountService.RegisterAccount(registrationRequest);
        }
        #endregion


        
    }
}
